package com.gexin.model.agent;

import com.gexin.common.utils.SQLUtils;
import com.gexin.model.agent.base.BaseAgentLevel;
import com.gexin.model.agent.base.BaseAgentProductSku;
import com.jfinal.plugin.activerecord.Page;

import java.util.List;


public class AgentProductSku extends BaseAgentProductSku<AgentProductSku> {
    public static final AgentProductSku dao = new AgentProductSku();

    public Page<AgentProductSku> findAgentProductSkubyId(Integer page,Integer pageSize,String agentId){
        SQLUtils sql = new SQLUtils();
        sql.append("from t_agent_product_sku agentprosku where 1=1");
        if(null!=agentId){
            sql.whereEquals("agent_id",agentId);
        }
        return paginate(page, pageSize,"select agentprosku.* ",sql.toString());
     }


    public  List<AgentProductSku> findByAgentId(String agentId){
        SQLUtils sqlUtils = new SQLUtils("select * from t_agent_product_sku where 1=1 ");
        if (null != agentId) {
            sqlUtils.whereEquals("agent_id", agentId);
        }
        return AgentProductSku.dao.find(sqlUtils.toString());
    }

}
